export default (_self, h) => {
  return h(
    "el-select",
    {
      props: {
        value: _self.obj.value || [],
        placeholder: _self.obj.placeholder,
        multiple: true,
        clearable: true
      },
      attrs: {
        disabled: !_self.obj.status,
      },
      on: {
        change: (e) => {
          _self.obj.value = e
        },
        "remove-tag": (v) => {
          _self.obj.value.map((item, i) => {
            if (item == v) {
              _self.obj.value.splice(i, 1);
              return;
            }
          });
        },
        clear: (e) => {
          _self.obj.value = []
        }
      },
    },
    _self.obj.detailList.map((v) => {
      return h(
        "el-option",
        {
          props: {
            label: v.label,
            value: v.value,
          },
        },
        v.label
      );
    })
  );
};

export let selectBoxConf = {
  status: true, // 启用状态，true启用；0停用
  elementWidth: "100%",
  elementType: "selectBox",// 对应数据库内类型
  elementName: "多选下拉框",// 控件左侧label内容
  placeholder: '请选择',
  value: [], // 绑定的值
  detailList: [ // 选项内数据
    {
      key: 0,
      label: "选项框1",
      value: "选项框1",
    },
    {
      key: 1,
      label: "选项框2",
      value: "选项框2",
    }
  ],
  key: 2,//配置的起始key
  icon: "el-icon-caret-bottom",
  required: false,
  rules: []

};
